import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

import org.apache.commons.lang3.StringUtils;

/**
 * @author wuyingge
 * @version 1.0.0
 * @ClassName SaveAnswerOptionMatch.java
 * @Description 答题匹配
 * @createTime 2022年05月11日 09:13:00
 */
public class SaveAnswerOptionMatch {

    public static void main(String[] args) {
        String sigleReg = "^A$|^B$|^C$|^D$|^E$|^F$";
        String option = "A";
        System.out.println(Pattern.compile(sigleReg).matcher(option).matches());

        String op1 = "AB";
        System.out.println(Pattern.compile(sigleReg).matcher(op1).matches());

        String op2 = "G";
        System.out.println(Pattern.compile(sigleReg).matcher(op2).matches());

        String op3 = "http:";
        System.out.println(Pattern.compile(sigleReg).matcher(op3).matches());

        String op4 = "c";
        System.out.println(Pattern.compile(sigleReg).matcher(op4).matches());
        System.out.println("-----------------------------------------------------------");


        String judgeReg = "^0$|^1$";
        String one = "0";
        String two = "1";
        String three = "01";
        String four = "A";
        String five = "HTTP";

        System.out.println(Pattern.compile(judgeReg).matcher(one).matches());
        System.out.println(Pattern.compile(judgeReg).matcher(two).matches());
        System.out.println(Pattern.compile(judgeReg).matcher(three).matches());
        System.out.println(Pattern.compile(judgeReg).matcher(four).matches());
        System.out.println(Pattern.compile(judgeReg).matcher(five).matches());

        String otps = "599a4a0a7b17409e8a52d935802c31fd";
        List<String> answeredList = new ArrayList<>(4);
        answeredList.add("A");
        answeredList.add("");
        answeredList.add("");
        answeredList.add("C");
        //多选题的时候处理重复选项
        String userAnswerStr = answeredList.size() > 0 ? StringUtils.join(answeredList, ",") : "";
        System.out.println(userAnswerStr);
    }
}
